<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

</head>

<body>
  <h3 id='tag'></h3>

  <script>
    var tag = document.getElementById('tag')
    window.onload = function () {
      let a = 1
      let timer = setInterval(function () {
        tag.innerHTML = a++
        if (a == 6) {
          clearInterval(timer)
        }
        // tag.innerHTML = a--

      }, 1000)
    }
  </script>

</body>

</html>